<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
  <title>Description of VMT_PlotDAVvectors</title>
  <meta name="keywords" content="VMT_PlotDAVvectors">
  <meta name="description" content="Plots a plan view vector field using the given velocity">
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="generator" content="m2html &copy; 2005 Guillaume Flandin">
  <meta name="robots" content="index, follow">
  <link type="text/css" rel="stylesheet" href="../m2html.css">
  <script type="text/javascript">
    if (top.frames.length == 0) { top.location = "../index.html"; };
  </script>
</head>
<body>
<a name="_top"></a>
<!-- menu.html VMT_4.0_dev -->
<h1>VMT_PlotDAVvectors
</h1>

<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>Plots a plan view vector field using the given velocity</strong></div>

<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>function VMT_PlotDAVvectors(Easting,Northing,DAVeast,DAVnorth,ascale,QuiverSpacing,plot_metric) </strong></div>

<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre class="comment"> Plots a plan view vector field using the given velocity
 components.  Input DAV are assumend to be in meters per second.
 Used by ASCII2GIS tool

 P.R. Jackson, USGS, 5-11-11</pre></div>

<!-- crossreference -->
<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
This function calls:
<ul style="list-style-image:url(../matlabicon.gif)">
</ul>
This function is called by:
<ul style="list-style-image:url(../matlabicon.gif)">
</ul>
<!-- crossreference -->

<h2><a name="_subfunctions"></a>SUBFUNCTIONS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<ul style="list-style-image:url(../matlabicon.gif)">
<li><a href="#_sub1" class="code">function mypostcallback_zoom(obj,evd)</a></li><li><a href="#_sub2" class="code">function mypostcallback_pan(obj,evd)</a></li></ul>

<h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre>0001 <a name="_sub0" href="#_subfunctions" class="code">function VMT_PlotDAVvectors(Easting,Northing,DAVeast,DAVnorth,ascale,QuiverSpacing,plot_metric)</a>
0002 <span class="comment">% Plots a plan view vector field using the given velocity</span>
0003 <span class="comment">% components.  Input DAV are assumend to be in meters per second.</span>
0004 <span class="comment">% Used by ASCII2GIS tool</span>
0005 <span class="comment">%</span>
0006 <span class="comment">% P.R. Jackson, USGS, 5-11-11</span>
0007 
0008 warning off
0009 disp(<span class="string">'Plotting Plan View with Depth-Averaged Velocity Vectors...'</span>)
0010 
0011 <span class="comment">%% User Input</span>
0012 
0013 <span class="keyword">if</span> exist(<span class="string">'plot_metric'</span>)==0
0014     plot_metric  = 1;
0015     disp(<span class="string">'No units specified, plotting in metric units by default'</span>)
0016 <span class="keyword">end</span>
0017 
0018 
0019 <span class="comment">%% Plot Quivers on Map</span>
0020 
0021 toquiv(:,1) = Easting(1:QuiverSpacing:end);
0022 toquiv(:,2) = Northing(1:QuiverSpacing:end);
0023 toquiv(:,3) = DAVeast(1:QuiverSpacing:end);
0024 toquiv(:,4) = DAVnorth(1:QuiverSpacing:end);
0025 vr = sqrt(toquiv(:,3).^2+toquiv(:,4).^2);
0026 
0027 figure(2); clf
0028 
0029 <span class="comment">%quiverc2wcmap(toquiv(:,1),toquiv(:,2),toquiv(:,3),toquiv(:,4),0,vr,1);</span>
0030 <span class="keyword">if</span> ~plot_metric
0031     figure(2); hold on
0032     quiverc(toquiv(:,1),toquiv(:,2),toquiv(:,3)*3.281,toquiv(:,4)*3.281,ascale);  <span class="comment">%*3.281 to go from m/s to ft/s</span>
0033     colorbar(<span class="string">'FontSize'</span>,16,<span class="string">'XColor'</span>,<span class="string">'w'</span>,<span class="string">'YColor'</span>,<span class="string">'w'</span>);
0034     <span class="keyword">if</span> sum(~isnan(vr)) == 0
0035         errordlg(<span class="string">'No Valid Data'</span>,<span class="string">'Plotting Error'</span>);
0036     <span class="keyword">end</span>
0037     disp([<span class="string">'DAV range (ft/s) = '</span> num2str(nanmin(vr)*3.281) <span class="string">' to '</span> num2str(nanmax(vr)*3.281)])
0038     caxis([nanmin(vr*3.281) nanmax(vr*3.281)])  <span class="comment">%resets the color bar axis from 0 to 64 to span the velocity mag range</span>
0039     title(<span class="string">'Depth-Averaged Velocities (ft/s)'</span>,<span class="string">'Color'</span>,<span class="string">'w'</span>);
0040     
0041 <span class="keyword">else</span>  <span class="comment">%plot in metric units</span>
0042     figure(2); hold on
0043     quiverc(toquiv(:,1),toquiv(:,2),toquiv(:,3),toquiv(:,4),ascale);
0044     colorbar(<span class="string">'FontSize'</span>,16,<span class="string">'XColor'</span>,<span class="string">'w'</span>,<span class="string">'YColor'</span>,<span class="string">'w'</span>);
0045     <span class="keyword">if</span> sum(~isnan(vr)) == 0
0046         errordlg(<span class="string">'No Valid Data'</span>,<span class="string">'Plotting Error'</span>);
0047     <span class="keyword">end</span>
0048     disp([<span class="string">'DAV range (m/s) = '</span> num2str(nanmin(vr)) <span class="string">' to '</span> num2str(nanmax(vr))])
0049     caxis([nanmin(vr) nanmax(vr)])  <span class="comment">%resets the color bar axis from 0 to 64 to span the velocity mag range</span>
0050     title(<span class="string">'Depth-Averaged Velocities (m/s)'</span>,<span class="string">'Color'</span>,<span class="string">'w'</span>);
0051 <span class="keyword">end</span>
0052 xlabel(<span class="string">'UTM Easting (m)'</span>)
0053 ylabel(<span class="string">'UTM Northing (m)'</span>)
0054 figure(2); box on
0055 set(gcf,<span class="string">'Color'</span>,[0 0 0]) <span class="comment">%[0.2 0.2 0.2]</span>
0056 set(gca,<span class="string">'DataAspectRatio'</span>,[1 1 1],<span class="string">'PlotBoxAspectRatio'</span>,[1 1 1])
0057 set(gca,<span class="string">'TickDir'</span>,<span class="string">'out'</span>)
0058 
0059 <span class="comment">% Format the ticks for UTM and allow zooming and panning</span>
0060 ticks_format(<span class="string">'%6.0f'</span>,<span class="string">'%8.0f'</span>); <span class="comment">%formats the ticks for UTM</span>
0061 hdlzm = zoom;
0062 set(hdlzm,<span class="string">'ActionPostCallback'</span>,@<a href="#_sub1" class="code" title="subfunction mypostcallback_zoom(obj,evd)">mypostcallback_zoom</a>);
0063 set(hdlzm,<span class="string">'Enable'</span>,<span class="string">'on'</span>);
0064 hdlpn = pan;
0065 set(hdlpn,<span class="string">'ActionPostCallback'</span>,@<a href="#_sub2" class="code" title="subfunction mypostcallback_pan(obj,evd)">mypostcallback_pan</a>);
0066 set(hdlpn,<span class="string">'Enable'</span>,<span class="string">'on'</span>);
0067 
0068 disp(<span class="string">'Plotting Complete...'</span>)
0069 
0070 
0071 <span class="comment">%% Embedded functions</span>
0072 <a name="_sub1" href="#_subfunctions" class="code">function mypostcallback_zoom(obj,evd)</a>
0073 ticks_format(<span class="string">'%6.0f'</span>,<span class="string">'%8.0f'</span>); <span class="comment">%formats the ticks for UTM (when zooming)</span>
0074 
0075 <a name="_sub2" href="#_subfunctions" class="code">function mypostcallback_pan(obj,evd)</a>
0076 ticks_format(<span class="string">'%6.0f'</span>,<span class="string">'%8.0f'</span>); <span class="comment">%formats the ticks for UTM (when panning)</span>
0077</pre></div>
<hr><address>Generated on Thu 21-Mar-2013 09:32:01 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/" target="_parent">m2html</a></strong> &copy; 2005</address>
</body>
</html>